/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entidades;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Damian
 */
@Entity
@Table(name = "offer_comment")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "OfferComment.findAll", query = "SELECT o FROM OfferComment o"),
    @NamedQuery(name = "OfferComment.findByIdOfferComment", query = "SELECT o FROM OfferComment o WHERE o.idOfferComment = :idOfferComment"),
    @NamedQuery(name = "OfferComment.findByComment", query = "SELECT o FROM OfferComment o WHERE o.comment = :comment")})
public class OfferComment implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID_OFFER_COMMENT")
    private Integer idOfferComment;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 250)
    @Column(name = "COMMENT")
    private String comment;
    @JoinColumn(name = "ID_CLIENT", referencedColumnName = "ID_CLIENT")
    @ManyToOne(optional = false)
    private Client idClient;
    @JoinColumn(name = "ID_OFFER", referencedColumnName = "ID_OFFER")
    @ManyToOne(optional = false)
    private Offer idOffer;

    public OfferComment() {
    }

    public OfferComment(Integer idOfferComment) {
        this.idOfferComment = idOfferComment;
    }

    public OfferComment(Integer idOfferComment, String comment) {
        this.idOfferComment = idOfferComment;
        this.comment = comment;
    }

    public Integer getIdOfferComment() {
        return idOfferComment;
    }

    public void setIdOfferComment(Integer idOfferComment) {
        this.idOfferComment = idOfferComment;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public Client getIdClient() {
        return idClient;
    }

    public void setIdClient(Client idClient) {
        this.idClient = idClient;
    }

    public Offer getIdOffer() {
        return idOffer;
    }

    public void setIdOffer(Offer idOffer) {
        this.idOffer = idOffer;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idOfferComment != null ? idOfferComment.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OfferComment)) {
            return false;
        }
        OfferComment other = (OfferComment) object;
        if ((this.idOfferComment == null && other.idOfferComment != null) || (this.idOfferComment != null && !this.idOfferComment.equals(other.idOfferComment))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.OfferComment[ idOfferComment=" + idOfferComment + " ]";
    }
    
}
